package com.charging.system.service.impl;

import java.util.List;
import com.charging.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.charging.system.mapper.KxRechargeSchemeMapper;
import com.charging.system.domain.KxRechargeScheme;
import com.charging.system.service.IKxRechargeSchemeService;

/**
 * 充值规则Service业务层处理
 *
 * @author charging
 * @date 2024-04-19
 */
@Service
public class KxRechargeSchemeServiceImpl implements IKxRechargeSchemeService
{
    @Autowired
    private KxRechargeSchemeMapper kxRechargeSchemeMapper;

    /**
     * 查询充值规则
     *
     * @param rechargeSchemeId 充值规则主键
     * @return 充值规则
     */
    @Override
    public KxRechargeScheme selectKxRechargeSchemeByRechargeSchemeId(Long rechargeSchemeId)
    {
        return kxRechargeSchemeMapper.selectKxRechargeSchemeByRechargeSchemeId(rechargeSchemeId);
    }

    /**
     * 查询充值规则列表
     *
     * @param kxRechargeScheme 充值规则
     * @return 充值规则
     */
    @Override
    public List<KxRechargeScheme> selectKxRechargeSchemeList(KxRechargeScheme kxRechargeScheme)
    {
        return kxRechargeSchemeMapper.selectKxRechargeSchemeList(kxRechargeScheme);
    }

    /**
     * 新增充值规则
     *
     * @param kxRechargeScheme 充值规则
     * @return 结果
     */
    @Override
    public int insertKxRechargeScheme(KxRechargeScheme kxRechargeScheme)
    {
        kxRechargeScheme.setCreateTime(DateUtils.getNowDate());
        return kxRechargeSchemeMapper.insertKxRechargeScheme(kxRechargeScheme);
    }

    /**
     * 修改充值规则
     *
     * @param kxRechargeScheme 充值规则
     * @return 结果
     */
    @Override
    public int updateKxRechargeScheme(KxRechargeScheme kxRechargeScheme)
    {
        kxRechargeScheme.setUpdateTime(DateUtils.getNowDate());
        return kxRechargeSchemeMapper.updateKxRechargeScheme(kxRechargeScheme);
    }

    /**
     * 批量删除充值规则
     *
     * @param rechargeSchemeIds 需要删除的充值规则主键
     * @return 结果
     */
    @Override
    public int deleteKxRechargeSchemeByRechargeSchemeIds(Long[] rechargeSchemeIds)
    {
        return kxRechargeSchemeMapper.deleteKxRechargeSchemeByRechargeSchemeIds(rechargeSchemeIds);
    }

    /**
     * 删除充值规则信息
     *
     * @param rechargeSchemeId 充值规则主键
     * @return 结果
     */
    @Override
    public int deleteKxRechargeSchemeByRechargeSchemeId(Long rechargeSchemeId)
    {
        return kxRechargeSchemeMapper.deleteKxRechargeSchemeByRechargeSchemeId(rechargeSchemeId);
    }
}
